﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAO;
using LogicaNegocio;


namespace Minutero
{
    public partial class TipoReunion : Form
    {
        public TipoDeReunion td;

        Form form = new Form();
        public TipoReunion() { }
        public TipoReunion(Form f)
        {
            InitializeComponent();
            form = f;
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void btn_Agregar_Click(object sender, EventArgs e)
        {
            td = new TipoDeReunion();
            td.Nombre = txt_Nombre.Text;
            td.Descripcion = txt_Descripcion.Text;
            if (txt_Nombre.Text != "")
            {
                if (Gestor.agregarTipoReunion(td) == true)
                {
                    txt_Descripcion.Text = "";
                    txt_Nombre.Text = "";
                    lbl_TipoReunion.Visible = true;
                    lbl_TipoReunion.Text = "Se agrego correctamente";                    
                    
                }
                else
                {
                    lbl_TipoReunion.Visible = true;
                    lbl_TipoReunion.Text = "No se pudo agregar el tipo de reunión";                     
                }
            }
            else 
            {
                lbl_TipoReunion.Visible = true;
                lbl_TipoReunion.Text = "El Nombre de Tipo de Reunion es necesario";                
            }
        }

        private void TipoReunion_FormClosed(object sender, FormClosedEventArgs e)
        {
            //Form fm = new Menu();
            //fm.Show();
            form.Show();
        }

        private void btn_Volver_Click(object sender, EventArgs e)
        {
            this.Close();

        }

        private void txt_Nombre_TextChanged(object sender, EventArgs e)
        {
            lbl_TipoReunion.Visible = false;
        }



       
    }
}
